import type { Metadata } from 'next'; import Link from 'next/link'; import { IncidentSeriesChart } from '@/components/incidents/IncidentSeriesChart'; import { TYPE_LABEL } from '@/components/incidents/IncidentRow'; import { Bar, ConfBar, Section, Stat, StatusDot } from '@/components/ui/primitives'; import { apiGet, apiTry } from '@/lib/api'; import { fmt, fmtDuration, fmtInt, fmtRatio } from '@/lib/format'; import { pressureColor } from '@/lib/pressure'; import { Time } from '@/lib/time'; import type { IncidentDetail } from '@/lib/types'; export const dynamic = 'force-dynamic'; type Params = Promise<{ slug: string }>; export async function generateMetadata({ params }: { params: Params }): Promise { const { slug } = await params; const i = await apiTry(`/api/v1/incident/${encodeURIComponent(slug)}`); if (!i) return { title: 'Incident' }; return { title: `${i.title} — ${i.status}, peak ${fmt(i.peak_pressure)}`, description: i.summary, alternates: { canonical: `/event/${i.slug}` }, openGraph: { type: 'article', publishedTime: i.started_at, modifiedTime: i.updated_at } }; } function scopeHref(i: IncidentDetail): string | null { if (i.scope_type === 'region' && i.scope_id) return `/internet/${i.scope_id}`; if (i.scope_type === 'country' && i.scope_id) return `/country/${i.scope_id.toLowerCase()}`; if (i.scope_type === 'asn' && i.scope_id) return `/asn/${i.scope_id}`; if (i.scope_type === 'service' && i.scope_id) return `/service/${i.scope_id}`; return null; } export default async function EventPage({ params }: { params: Params }) { const { slug } = await params; const i = await apiGet(`/api/v1/incident/${encodeURIComponent(slug)}`); const href = scopeHref(i); return (

{TYPE_LABEL[i.type] ?? i.type} {i.event_id}

{i.title}

{i.summary}

scope{' '} {href ? ( {i.scope_label} ) : ( {i.scope_label} )} started {i.ended_at ? ( <> ended duration {fmtDuration(i.duration_s)}

current
{fmt(i.current_pressure)}
peak
{fmt(i.peak_pressure)}
confidence
incident scope vs global pressure · from 30 min before detection}>
    {i.timeline.map((t, idx) => (
  1. ))}
never overstated · confidence-weighted} className="min-w-0"> {i.hypotheses.length ? (
    {i.hypotheses.map((h, idx) => (
  • {h.text}

    {Math.round(h.confidence * 100)} %
      {h.evidence.map((e, k) => (
    • · {e}
    • ))}
  • ))}
) : (

No causal hypothesis reached the minimum confidence.

)}
signal · scope · current vs baseline · robust z}>
{i.evidence.map((e, idx) => ( ))}
Signal Scope Current Baseline z Samples At
{e.label} {e.signal_id} {e.scope_id ? `${e.scope_type}:${e.scope_id}` : e.scope_type} {fmt(e.current, Math.abs(e.current) < 1 ? 3 : 1)} {fmt(e.baseline, Math.abs(e.baseline) < 1 ? 3 : 1)} = 3 ? 'var(--p-high)' : 'var(--ink)' }}> {fmt(e.robust_z)} {fmtInt(e.samples)}
{i.bgp && (
)}
    {i.probes.map((p) => (
  • {p.probe_id} {p.region} {p.observation}
  • ))}
    {i.targets.map((t) => (
  • {t.name} {t.observation}
  • ))}
{i.affected_asns.map((a) => ( AS{a} ))} {i.affected_services.map((s) => ( {s} ))}
{i.annotations.length ? (
    {i.annotations.map((a, idx) => (
  • {a.text}

    {a.author} ·

  • ))}
) : (

No human annotation yet.

)}
); }